import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  OtherEnterWarehouseOrderVO,
  OtherEnterWarehouseOrderForm,
  OtherEnterWarehouseOrderQuery
} from '@/api/jdAndJstSceneClassification/otherInStock/jdOtherEnterWarehouseOrder/types';

/**
 * 查询金蝶-其他入库单列表
 * @param query
 * @returns {*}
 */
export const listOtherEnterWarehouseOrder = (query?: OtherEnterWarehouseOrderQuery): AxiosPromise<OtherEnterWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/otherEnterWarehouseOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-其他入库单列表
 * 01、定义后端接口
 * @param query
 * @returns {*}
 */
export const listOtherEnterWarehouseOrderByOrderNumber1 = (query?: OtherEnterWarehouseOrderQuery): AxiosPromise<OtherEnterWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/otherEnterWarehouseOrder/list-by-order-number1',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-其他入库单详细
 * @param id
 */
export const getOtherEnterWarehouseOrder = (id: string | number): AxiosPromise<OtherEnterWarehouseOrderVO> => {
  return request({
    url: '/dataCheck/jd/otherEnterWarhouseOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增金蝶-其他入库单
 * @param data
 */
export const addOtherEnterWarehouseOrder = (data: OtherEnterWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jd/otherEnterWarehouseOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改金蝶-其他入库单
 * @param data
 */
export const updateOtherEnterWarehouseOrder = (data: OtherEnterWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jd/otherEnterWarehouseOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除金蝶-其他入库单
 * @param id
 */
export const delOtherEnterWarehouseOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jd/otherEnterWarehouseOrder/' + id,
    method: 'delete'
  });
};
